<html>
<head><meta charset="utf-8"><title>using const-qualif for const-checking · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html">using const-qualif for const-checking</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="167209823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209823">(Jun 03 2019 at 16:59)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> about my proposal to basically implement const-checking as "qualif everything and make sure nothing complains", to hopefully reduce duplication:</p>
<blockquote>
<p>there are side-effects that don't produce a value</p>
</blockquote>
<p>well but "qualif" also checks whether functions are <code>const fn</code>, even if they return <code>()</code>. so clearly they already are about side-effects, not just about the value produced.</p>



<a name="167209926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209926">(Jun 03 2019 at 17:00)</a>:</h4>
<p>yes because it doesn't know it can synthesize a <code>()</code> out of thin air</p>



<a name="167209955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209955">(Jun 03 2019 at 17:00)</a>:</h4>
<p>eventually we might do just that :P</p>



<a name="167209978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209978">(Jun 03 2019 at 17:00)</a>:</h4>
<p>in fact, the old AST-based promoter had some special-cases for various "obviously ZST constructor"s</p>



<a name="167209981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209981">(Jun 03 2019 at 17:00)</a>:</h4>
<p>wait so <code>&amp;foo()</code> should just become <code>&amp;()</code> during <em>implicit promotion</em>??</p>



<a name="167209991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209991">(Jun 03 2019 at 17:01)</a>:</h4>
<p>no</p>



<a name="167209997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167209997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167209997">(Jun 03 2019 at 17:01)</a>:</h4>
<p>the call isn't promoted away</p>



<a name="167210007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210007">(Jun 03 2019 at 17:01)</a>:</h4>
<p>it'd become <code>{ foo(); &amp;() }</code></p>



<a name="167210020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210020">(Jun 03 2019 at 17:01)</a>:</h4>
<p>but that's what I am saying -- promotion is not just about values, it's also about effects... wait what?^^</p>



<a name="167210042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210042">(Jun 03 2019 at 17:01)</a>:</h4>
<p>no! it's about, <em>at most</em>, the effects <em>needed</em> to obtain that value!</p>



<a name="167210098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210098">(Jun 03 2019 at 17:02)</a>:</h4>
<p>"the effects needed to run that computation"</p>



<a name="167210102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210102">(Jun 03 2019 at 17:02)</a>:</h4>
<p>it's about the computational needs</p>



<a name="167210109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210109">(Jun 03 2019 at 17:02)</a>:</h4>
<p>the same value, <code>42</code>, can be obtained without effects</p>



<a name="167210117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210117">(Jun 03 2019 at 17:02)</a>:</h4>
<p>yes but how do you know it's 42?</p>



<a name="167210122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210122">(Jun 03 2019 at 17:02)</a>:</h4>
<p>at compile-time</p>



<a name="167210124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210124">(Jun 03 2019 at 17:02)</a>:</h4>
<p>(replace <code>()</code> by <code>i32</code> in my example above, my argument stands and now you cannot synthesize)</p>



<a name="167210144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210144">(Jun 03 2019 at 17:03)</a>:</h4>
<p>all I am saying is we are not talking about properties of a value here, but abourt properties of a computation</p>



<a name="167210170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210170">(Jun 03 2019 at 17:03)</a>:</h4>
<p>yes, computation <em>for</em> the "future runtime value"</p>



<a name="167210183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210183">(Jun 03 2019 at 17:03)</a>:</h4>
<p>and so I dont see why we cannot cast the question "may this <code>const</code> body computation occur at compile-time" in the same framework as the question "may this temporary be promoted implicitly"</p>



<a name="167210253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210253">(Jun 03 2019 at 17:04)</a>:</h4>
<p>the final value may not depend on the side-effects</p>



<a name="167210265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210265">(Jun 03 2019 at 17:04)</a>:</h4>
<p>where currently we have qualifs for the latter but a visitor for the former</p>



<a name="167210274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210274">(Jun 03 2019 at 17:04)</a>:</h4>
<blockquote>
<p>the final value may not depend on the side-effects</p>
</blockquote>
<p>so? that's the case either way?</p>



<a name="167210279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210279">(Jun 03 2019 at 17:04)</a>:</h4>
<p>heck, I think we promote <code>&amp;{ println!("foo"); 5 }</code> today, let me check</p>



<a name="167210335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210335">(Jun 03 2019 at 17:05)</a>:</h4>
<p>even if we do, not sure how that changes anything. that's just a weird notion of "subterm".</p>



<a name="167210352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210352">(Jun 03 2019 at 17:05)</a>:</h4>
<p>I'm saying that checking whether the computation that ends up in the return slot is promotable, doesn't tell you whether you can execute <em>the entire body</em></p>



<a name="167210429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210429">(Jun 03 2019 at 17:06)</a>:</h4>
<p>because there is no reification of the "worldstate" on exit</p>



<a name="167210447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210447">(Jun 03 2019 at 17:06)</a>:</h4>
<p>if we had VSDG, this would be a much more different discussion</p>



<a name="167210453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210453">(Jun 03 2019 at 17:06)</a>:</h4>
<p>then, yes, you could qualify everything with dataflow</p>



<a name="167210457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210457">(Jun 03 2019 at 17:06)</a>:</h4>
<p>same thing for lambda calculus</p>



<a name="167210471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210471">(Jun 03 2019 at 17:06)</a>:</h4>
<p>still, the checker has very fine-grained messages. qualification loses that detail</p>



<a name="167210480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210480">(Jun 03 2019 at 17:07)</a>:</h4>
<blockquote>
<p>same thing for lambda calculus</p>
</blockquote>
<p>now you lost me entirely^^</p>



<a name="167210489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210489">(Jun 03 2019 at 17:07)</a>:</h4>
<p>I meant pure functional code</p>



<a name="167210494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210494">(Jun 03 2019 at 17:07)</a>:</h4>
<p>side-effects are encoded in dataflow</p>



<a name="167210502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210502">(Jun 03 2019 at 17:07)</a>:</h4>
<blockquote>
<p>still, the checker has very fine-grained messages. qualification loses that detail</p>
</blockquote>
<p>right I understand that. I hate it when diagnostics makes the important code more ugly :(</p>



<a name="167210504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210504">(Jun 03 2019 at 17:07)</a>:</h4>
<p>VSDG is just first-order functional calculus w/ linear types</p>



<a name="167210511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210511">(Jun 03 2019 at 17:07)</a>:</h4>
<p>but I wanted to understand if diagnostics is the <em>only</em> reason</p>



<a name="167210526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210526">(Jun 03 2019 at 17:08)</a>:</h4>
<p>diagnostics are <em>the main</em> reason</p>



<a name="167210573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210573">(Jun 03 2019 at 17:08)</a>:</h4>
<p>you'd still need a visitor for side-effects that don't (always) affect values</p>



<a name="167210615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210615">(Jun 03 2019 at 17:09)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=50042f128ce6e1d1be43b495e5f1ef1e" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=50042f128ce6e1d1be43b495e5f1ef1e">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=50042f128ce6e1d1be43b495e5f1ef1e</a></p>



<a name="167210655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/using%20const-qualif%20for%20const-checking/near/167210655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/using.20const-qualif.20for.20const-checking.html#167210655">(Jun 03 2019 at 17:09)</a>:</h4>
<blockquote>
<p>I'm saying that checking whether the computation that ends up in the return slot is promotable, doesn't tell you whether you can execute <em>the entire body</em></p>
</blockquote>
<p>sure, that has no bearing on my question though I don't think. once we cannot "peak" the computation any more because it's a <code>const fn</code> we still fall back to checking computation, and more importantly, <em>relying only on the type here would be unsound</em> -- which demonstrates that this is <em>not</em> an analysis of the value <code>V</code>, but of the computation <code>M V</code> living in some monad and eventually producing the value.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>